import path from "path";
import { app, BrowserWindow, netLog } from "electron";
import { createWindow } from "./utils";
import "./ipc";
import "./blive";

let win: BrowserWindow | null;
function createMainWindow() {
  setProtocolClient();
  //netLog.startLogging('./net-log.txt');
  win = createWindow("/plugin");
}

app.on("window-all-closed", () => {
  win = null;
});

function setProtocolClient() {
  if (app.isPackaged) {
    app.setAsDefaultProtocolClient("scheme");
  } else {
    app.setAsDefaultProtocolClient("scheme", process.execPath, [
      path.resolve(process.argv[1])
    ]);
  }
}
app.whenReady().then(createMainWindow);
